{template 'common/header'}
<ul class="nav nav-tabs">
        <li>
        	<a href="{php echo $this->createWebUrl('phone', array('op' => 'list'));}">号码管理</a>
        </li>
        
        <li {if $op == 'add'}class="active" {/if}>
        	<a href="{php echo $this->createWebUrl('phone', array('op' => 'add'));}">{if $_GPC['id']}修改号码{else}新增号码{/if}</a>
        </li>
      
        
    </ul>
    <form action="" class="form-horizontal form" method="post" role="form" enctype="multipart/form-data" onsubmit="return check(this);">
        <input type="hidden" name="id" value="{$item['id']}">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title">号码信息</h3>
          </div>
          <div class="panel-body">
            <div class="form-group">
                <label for="displayorder" class="col-sm-2 control-label">排序</label>
                <div class="col-sm-4">
                  <input type='text' name='displayorder' id='displayorder' class="form-control" value="{$item['displayorder']}" placeHolder="请输入数字"/>
                </div>
            </div>
            <div class="form-group">
                <label for="phone" class="col-sm-2 control-label">号码</label>
                <div class="col-sm-4">
                  <input type='text' name='phone' id='phone' class="form-control" value="{$item['phone']}" placeHolder="请输入号码"/>
                </div>
            </div>
            <div class="form-group">
                <label for="content" class="col-sm-2 control-label">图片</label>
                <div class="col-sm-5">
                    {php echo tpl_form_field_image(thumb,$item['thumb']);}
                </div>
            </div>
            <div class="form-group">
                <label for="content" class="col-sm-2 control-label">描述</label>
                <div class="col-sm-5">
                	<textarea  name='content' class="form-control" placeHolder="请输入描述">{$item['content']}</textarea>
                </div>
            </div>
            {if !$user['regionid']}
            <div class="form-group">
                <label for="content" class="col-sm-2 control-label">选择小区</label>
                <div class="col-sm-5">
                    <label class="checkbox-inline">
                        <input type="checkbox" id="checkAll" name="checkAll" data-group="regionid">全部
                    </label>
                    {loop $regions $region}
                    <label class="checkbox-inline">
                        <input type="checkbox" id="regionid" value="{$region['id']}" name='regionid[]' data-group="regionid" {if @in_array($region[ 'id'], $regs)}checked='checked' {/if}> {$region['city']}{$region['dist']}{$region['title']}
                    </label>
                    {/loop}
                </div>
	        </div>
            {/if}
            <div class="form-group">
                <label for="" class="col-sm-2 control-label"></label>
                <div class="col-sm-5">
                   <button type="submit" class="btn btn-primary span3" name="submit" value="提交">提交</button>
                    <input type="hidden" name="token" value="{$_W['token']}" />
                </div>
            </div>
          </div>
        </div>

    </form>
    <script type="text/javascript">
        function check(form){
            if (!form['phone'].value) {
            alert('请输入号码信息。');
            return false;
            }
            if (!form['content'].value) {
                alert('请输入号码描述！');
                return false;
            }
            return true;
            }
        $(function() {
            $("#checkAll").click(function() {

                var checked = $(this).get(0).checked;
                var group = $(this).data('group');
                $("#regionid[data-group='" + group + "']").each(function() {
                    $(this).get(0).checked = checked;
                })

            });
        });
    </script>


{template 'common/footer'}